package com.nali.spreader.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;

import com.nali.spreader.dao.ICrudUserGroupDao;
import com.nali.spreader.model.UserGroup;
import com.nali.spreader.model.UserGroupExample;

@Repository
public class CrudUserGroupDao implements ICrudUserGroupDao {
    /**
     * This field was generated by Apache iBATIS ibator.
     * This field corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    @Autowired
    private SqlMapClientTemplate sqlMap;

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public CrudUserGroupDao() {
        super();
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int countByExample(UserGroupExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("spreader_tb_user_group.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int deleteByExample(UserGroupExample example) {
        int rows = getSqlMapClientTemplate().delete("spreader_tb_user_group.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int deleteByPrimaryKey(Long gid) {
        UserGroup key = new UserGroup();
        key.setGid(gid);
        int rows = getSqlMapClientTemplate().delete("spreader_tb_user_group.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public void insert(UserGroup record) {
        getSqlMapClientTemplate().insert("spreader_tb_user_group.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public void insertSelective(UserGroup record) {
        getSqlMapClientTemplate().insert("spreader_tb_user_group.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    @SuppressWarnings("unchecked")
    public List<UserGroup> selectByExampleWithBLOBs(UserGroupExample example) {
        List<UserGroup> list = getSqlMapClientTemplate().queryForList("spreader_tb_user_group.ibatorgenerated_selectByExampleWithBLOBs", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    @SuppressWarnings("unchecked")
    public List<UserGroup> selectByExampleWithoutBLOBs(UserGroupExample example) {
        List<UserGroup> list = getSqlMapClientTemplate().queryForList("spreader_tb_user_group.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public UserGroup selectByPrimaryKey(Long gid) {
        UserGroup key = new UserGroup();
        key.setGid(gid);
        UserGroup record = (UserGroup) getSqlMapClientTemplate().queryForObject("spreader_tb_user_group.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int updateByExampleSelective(UserGroup record, UserGroupExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("spreader_tb_user_group.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int updateByExampleWithBLOBs(UserGroup record, UserGroupExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("spreader_tb_user_group.ibatorgenerated_updateByExampleWithBLOBs", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int updateByExampleWithoutBLOBs(UserGroup record, UserGroupExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("spreader_tb_user_group.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int updateByPrimaryKeySelective(UserGroup record) {
        int rows = getSqlMapClientTemplate().update("spreader_tb_user_group.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int updateByPrimaryKeyWithBLOBs(UserGroup record) {
        int rows = getSqlMapClientTemplate().update("spreader_tb_user_group.ibatorgenerated_updateByPrimaryKeyWithBLOBs", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public int updateByPrimaryKeyWithoutBLOBs(UserGroup record) {
        int rows = getSqlMapClientTemplate().update("spreader_tb_user_group.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    public SqlMapClientTemplate getSqlMapClientTemplate() {
        return sqlMap;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table spreader.tb_user_group
     *
     * @ibatorgenerated Wed Jan 18 15:16:17 CST 2012
     */
    private static class UpdateByExampleParms extends UserGroupExample {
        private Object record;

        public UpdateByExampleParms(Object record, UserGroupExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}